package Cy.Servlet;

import java.io.IOException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import Cy.DAO.BrandDAO;
import Entity.Brand;
import Factory.BrandFactory;

/**
 * Servlet implementation class SelectupdatebrandServlet
 */
@WebServlet("/selectupdatebrand")
public class SelectupdatebrandServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;
	private BrandDAO brandDAO = BrandFactory.createDAO();
	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		request.setCharacterEncoding("utf-8");
		response.setContentType("text/html;charset=utf-8");
		try{
			int bid = Integer.parseInt(request.getParameter("bid"));
			request.setAttribute("bid", bid);
		}catch(Exception e){
		
		}
		List<Brand> list = brandDAO.selectupdatebrand();
		request.setAttribute("list", list);
		request.getRequestDispatcher("updateBrand.jsp").forward(request, response);
	}

}
